#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{

	int n, m, sum, num, i, j;
	while (1) {
		scanf("%d", &n);
		if (n == 0)
			break;
		sum = 0;
		for (i = 0; i < n; i++) {
			scanf("%d", &num);
			sum += num;
		}
		printf("%d\n", sum);
	}
	return 0;
}